<?php

namespace app\api\model;

use think\Model;

class ImGameCategory extends Model
{
    //开启自动完成时间戳功能
    protected $autoWriteTimestamp = true;
    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';

    /**
     * Notes:获取游戏分类
     * User: tangfen
     * Date: 2023/12/23
     * Time: 16:25
     */
    public function gameCategoryList($params)
    {
        $where = [];
        if(!empty($params['category_name']) && isset($params['category_name'])){
            $where[] = ['category_name', 'like', '%' . $params['category_name'] . '%'];
            $where[] = ['status','=',1];
        }
        $list =   $this::where($where)
                ->field('id,url,category_name,create_time')
                ->order('id desc')
                ->paginate($params['limit'], false, ['page' => $params['page']]);
        return $list;
    }


}